<template>
  <div>
    <ZgEdit
      ref="dialog"
      :view="viewData"
      :columns="columns"
      :formulas="formulas"
      validUrl=""
      saveUrl="">
    </ZgEdit>
  </div>
</template>
<script>
export default {
  data () {
    return {
      columns: [
        { name: '授信编号', code: 'num', divider: '授信流程', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '' },
        { name: '授信名称', code: 'name', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '' },
        { name: '产品类型', code: 'productType', compType: '单选', isNeed: true, offset: 0, span: 24, defaultVal: '1', extra: { 选项: [{ value: '1', label: '信用证' }, { value: '2', label: '银承' }] } },
        { name: '基础信息', code: 'baseInfo', divider: '企业要求', compType: '文本', offset: 0, span: 24, defaultVal: '' },
        { name: '企业类型', code: 'comType', compType: '多选', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'political' } },
        { name: '成立年限', code: 'year', compType: '下拉选择', isNeed: true, offset: 0, span: 12, defaultVal: '', extra: { 下拉选项: [{ value: '1', label: '1' }, { value: '2', label: '2' }] } },
        { name: '注册资本', code: 'score', compType: '浮点数', isNeed: true, offset: 0, span: 12, defaultVal: 0, unit: '万元' },
        { name: '行业分类', code: 'comType', compType: '多选', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'political' } },
        { name: '财务信用', code: 'baseInfo', compType: '文本', offset: 0, span: 24, defaultVal: '' }
      ],
      formulas: [],
      viewData: { width: '60%', top: '5%', title: '编辑' }
    }
  },
  methods: {
    open (json, pageType) {
      if (pageType === 'details') {
        this.$refs.dialog.open(json)
        this.viewData.title = '详情'
      } else {
        this.$refs.dialog.open(json)
        this.viewData.title = '编辑'
      }
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
